/**
 * 出栈操作
 * User: Zhikang.Peng
 * Date: 2018/04/11 09:49
 */
package stack

import "gitee.com/thghh/jvmgo/instructions/base"
import "gitee.com/thghh/jvmgo/rtda"

// 将栈顶数值弹出 (数值不能是long或double类型的)
type POP struct {
	base.NoOperandsInstruction
}

/*
bottom -> top
[...][c][b][a]
            |
            V
[...][c][b]
*/
func (self *POP) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	stack.PopSlot()
}

// 将栈顶的一个（long或double类型的)或两个数值弹出（其它）
type POP2 struct {
	base.NoOperandsInstruction
}

/*
bottom -> top
[...][c][b][a]
         |  |
         V  V
[...][c]
*/
func (self *POP2) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	stack.PopSlot()
	stack.PopSlot()
}
